<#--lst0中为一级菜单 -->
<#list lst0 as ls0>
		<#-- 遍历一级菜单-->
		 <div title="${ls0[0].actCname}" iconCls="icon-undo" style="overflow: auto;">
			 <#list lst1 as ls1>
			 <#-- 如果二级菜单中的fatherid为一级菜单的actid输出(判断subCount,是否二级菜单下有子菜单) -->
				<#if  ls1[0].fatherId = ls0[0].actId  & ls1[0].subCount=0 >
					
					
					
					<ul id="${ls1[0].actId}"></ul>
					
					<script type="text/javascript">
						var tree${ls1[0].actId}=[{
							"id":1,
							"text":"${ls1[0].actCname}",
							"attributes":{
								"url":"${ls1[1].lockPath}"
							},
							"state":"open"
							
						}];
					$(function(){
						$('#${ls1[0].actId}').tree({
							"data":tree${ls1[0].actId},
							"onClick":function(node){
								var a = node.attributes;
								if(a){
									var u = a.url;
									addTab(node.text,u);
								}
							}
						});
					});	
					</script>
				
				
		 			<#-- 判断 如果 二级菜单中的fatherid为一级菜单的actid并且subCount不为0(下边有子菜单)-->
		 			<#elseif ls1[0].fatherId = ls0[0].actId & ls1[0].subCount gt 0>
		 			<#-- 输出  ${ls0.actId} 为了function拿id-->
		 			
		 				<ul id="${ls1[0].actId}"></ul>
		 				<#--遍历所有菜单 -->
			 		<script type="text/javascript">
			 		<#--如果 一级菜单的fatherid为act的actid 或 二级菜单的faherid为act的fatherid,
			 		为了防止仍有子菜单,此处没有判断subCount-->
			 		<#list acts as act>
			 		<#if ls1[0].actId=act[0].fatherId>
		 				<#--输出 act.actCname -->
					
						<#-- js-->
						var tree${act[0].actId}=[{
							"id":${ls1[0].actId},
							"text":"${ls1[0].actCname}",
							"attributes":{
								"url":"${ls0[1].lockPath!""}"
							},
							"state":"open",
							<#if ls1[0].fatherId= ls0[0].actId>
							"children":[
								<#-- 遍历3级子菜单-->
								<#list lst2 as ls2>
								
								<#-- 判断3级子菜单的fatherid是否为二级菜单的actid  -->
									<#if ls2[0].fatherId= ls1[0].actId>
									
										{
											"id":${ls2[0].actId},
											"text":"${ls2[0].actCname}",
											<#if ls1[0].actId = ls2[0].fatherId & ls2[0].subCount gt 0>
											"children":[{
												id:"${ls1[0].actId}",
												text:"${ls1[0].actCname}",
													 }],
											</#if>
											"attributes":{
												"url":"${ls2[1].lockPath!""}"
														}
											
										},
									</#if>
								</#list>
								]
							
							</#if>
						}];
					
					$(function(){
						$('#${ls1[0].actId}').tree({
							"data":tree${act[0].actId},
							"onClick":function(node){
								var a = node.attributes;
								if(a){
									var u = a.url;
									addTab(node.text,u);
								}
							}
						});
					});
				
					
					
			 		</#if>
			 		</#list>
			 		
			 		</script>
		 		</#if>
		 	</#list>
		 </div>
</#list>
<script>
function addTab(title,url) {
						if ($('#main').tabs('exists', title)) {
							$('#main').tabs('close', title);
						}
				
						var content = '<iframe scrolling="auto" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe>';
						$('#main').tabs('add', {
							title : title,
							iconCls : '',
							content : content,
							closable : true
						});
				
					}

</script>
